package com.hue.client.service;

import com.hue.spring.annotation.Autowired;
import com.hue.spring.annotation.Component;
import com.hue.spring.annotation.Scope;
import com.hue.spring.aware.BeanNameAware;
import com.hue.spring.init.InitializingBean;

@Component
@Scope(value = "single")
public class UserServiceImpl implements BeanNameAware, InitializingBean, UserService {
    @Autowired(required = false)
    private BookService bookService;

    private String beanName;

    @Override
    public void test() {
        System.out.println(beanName + "执行了test方法");
    }

    public void beanName() {
        System.out.println(beanName);
    }

    @Override
    public void beanNameAware(String beanName) {
        this.beanName = beanName;
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println(beanName + "调用了初始化方法");
    }
}
